swap: remove the maxpages variable in sys_swapon#820
Conversation
|
Upstream branch: aa54b1d |
|
Upstream branch: aa54b1d |
081d8c9 to
9ad763d
Compare
|
Upstream branch: aa54b1d |
9ad763d to
521fd60
Compare
|
Upstream branch: aa54b1d |
521fd60 to
5334fba
Compare
|
Upstream branch: aa54b1d |
5334fba to
fc87575
Compare
|
Upstream branch: aa54b1d |
fc87575 to
409780a
Compare
b1870f6 to
ca57796
Compare
|
Upstream branch: 70eda68 |
409780a to
9de92b2
Compare
|
Upstream branch: 70eda68 |
9de92b2 to
d6d1edb
Compare
Always use si->max which is updated setup_swap_extents instead of copying into and out of maxpages. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Acked-by: Chris Li <chrisl@kernel.org>
Make the core swap code calculate sis->pages, nr_extents and the span, re-set sis->max based on it and don't require passing the current offset into the swap file to swap_add_extent as all that can trivially be calculated internally. Also truncate the spans based on the available information. All this removes a lot of boilerplate code in the callers. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Acked-by: Chris Li <chrisl@kernel.org>
The swap operations have nothing to do with the address_space, which is used for pagecache operations. Move them to struct file_operations instead. This will allow moving the block device special cases into block/fops.c subsequently. Pass struct file first to ->swap_activate as file operations typically get the file or iocb as first argument and use swap_activate instead of swapfile_activate in all names to be consistent. Note that while the trivial iomap wrappers are moved to a new file when applicable to keep them local to the file operation instances, complex implementation are kept in their existing place. It might be worth to move them in follow-on patches if the maintainers desire so. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Acked-by: Chris Li <chrisl@kernel.org>
Various swap code assumes it runs either on a block device or on a regular file. Make this restriction explicit using checks right after opening the file. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Acked-by: Chris Li <chrisl@kernel.org>
Reflow setup_swap_extents so that the flag checking is not conditional on a swap_activate method. This is currently a no-op because the swapoff code still checks the presence of a swap_deactivate method, but it simplifies adding a new check, and also makes the SWP_ACTIVATED flag more consistent. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Acked-by: Chris Li <chrisl@kernel.org>
Make use of the abstractions we have. This is a preparation for moving more special casing down into block/. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Acked-by: Chris Li <chrisl@kernel.org>
Don't blindly pass the value from the swap header to swap_add_extent, but instead the device size rounded down to page granularity. This activated the sanity checking in the core code that catches a too large value in the swap header. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
add_swap_extent already coalesces multiple extents, no need to duplicate that in the caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Only the file operation method knows what block device we'll swap to. So move down setting sis->bdev and the special blockdev flag into ->swap_activate. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Add a helper abstracting away the low-level details of enabling fs_ops-based swapping. This prepares for taking swap_info_struct private. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Acked-by: Chris Li <chrisl@kernel.org>
struct swap_extent is only used inside of mm/swapfile.c, so move it there. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Acked-by: Chris Li <chrisl@kernel.org>
swap_info_struct is now internal to the MM subsystem, so remove it from the public header. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Acked-by: Chris Li <chrisl@kernel.org>
|
Upstream branch: 70eda68 |
d6d1edb to
31e57ca
Compare
Pull request for series with
subject: swap: remove the maxpages variable in sys_swapon
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1093264